import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
a1 = 22
a2 = 27
b1 = 25
b2 = 24
pwma = 18
pwmb = 23
GPIO.setup(a1, GPIO.OUT)
GPIO.setup(a2, GPIO.OUT)
GPIO.setup(pwma, GPIO.OUT)
GPIO.setup(b1, GPIO.OUT)
GPIO.setup(b2, GPIO.OUT)
GPIO.setup(pwmb, GPIO.OUT)
pwma1 = GPIO.PWM(pwma,800)#设置pwm
pwmb1 = GPIO.PWM(pwmb,800)#设置pwm
pwma1.start(100)
pwmb1.start(100)
while True:
	GPIO.output(a1, GPIO.HIGH)
	GPIO.output(a2, GPIO.LOW)
	pwma1.ChangeDutyCycle(80)
	GPIO.output(b1, GPIO.HIGH)
	GPIO.output(b2, GPIO.LOW)
	pwmb1.ChangeDutyCycle(40)
GPIO.cleanup()